## Formhandler Configuration
plugin.Tx_Formhandler.settings.predef {
	formhandler-contact-form-a {
		## This is the title of the predefined form shown in the dropdown box in the plugin options.
		name = Contact From A

		# The formID setting is mandatory in combination with "enableFileRemoval=1". The formID is used to submit the right form on the page when clicking on the remove link.
		formID = contact-form-a

		## All form fields are prefixed with this values (e.g. contact[name])
		formValuesPrefix = contact

		langFile.1 = TEXT
		langFile.1.value = {$plugin.formhandler.languagePath}

		templateFile = TEXT
		templateFile.value = {$plugin.formhandler.rootPath}contact-form-a.html

		## The master template is a file containing the markup for specific field types or other sub templates (e.g. for emails). You can use these predefined markups in your HTML template for a specific form.
		masterTemplateFile = TEXT
		masterTemplateFile.value = {$plugin.formhandler.rootPath}mastertemplate.html

		## These wraps define how an error messages looks like. The message itself is set in the lang file.
		singleErrorTemplate {
			singleWrap = <span class="help-block">|</span>
		}

		# In case an error occurred, all markers ###is_error_[fieldname]### are filled with the configured value of the setting "default".
		isErrorMarker {
			default = has-error
		}

		markers {
			website_url = TEXT
			website_url.data = TSFE:baseUrl

			lll_nl2br_email_admin_text = TEXT
			lll_nl2br_email_admin_text {
				data = LLL:{$plugin.formhandler.languagePath}:email_admin_text
			}

			lll_nl2br_email_user_text = TEXT
			lll_nl2br_email_user_text {
				data = LLL:{$plugin.formhandler.languagePath}:email_user_text
			}
		}

		# This block defines the error checks performed when the user hits submit.
		validators {
			1.class = Validator_Default
			1.config.fieldConf {
				firstName.errorCheck.1 = required
				lastName.errorCheck.1 = required
				email.errorCheck.1 = required
				email.errorCheck.2 = email
				targetLanguage.errorCheck.1 = required
				sourceLanguage.errorCheck.1 = required
				phone.errorCheck.1 = required
				city.errorCheck.1 = required
				remarks.errorCheck.1 = maxLength
				remarks.errorCheck.1.value = 500
			}
		}

		# Finishers are called after the form was submitted successfully (without errors).
		finishers {

			# Finisher_Mail sends emails to an admin and/or the user.
			1.class = Finisher_Mail
			1.config {
				checkBinaryCrLf = message
				admin {
					templateFile = TEXT
					templateFile.value = {$plugin.formhandler.rootPath}email-admin-a.html
					sender_email = TEXT
					sender_email.data = GP:contact|email
					to_email = TEXT
					to_email.data = GP:contact|city
				}
			}

			# Finisher_Redirect will redirect the user to another page after the form was submitted successfully.
			5.class = Finisher_Redirect
			5.config {
				redirectPage = {$plugin.formhandler.contact-form.redirectPage}
			}
		}
	}

	formhandler-contact-form-b < .formhandler-contact-form-a
	formhandler-contact-form-b {
		## This is the title of the predefined form shown in the dropdown box in the plugin options.
		name = Contact From B

		# The formID setting is mandatory in combination with "enableFileRemoval=1". The formID is used to submit the right form on the page when clicking on the remove link.
		formID = contact-form-b

		## All form fields are prefixed with this values (e.g. contact[name])
		formValuesPrefix = contact

		templateFile = TEXT
		templateFile.value = {$plugin.formhandler.rootPath}contact-form-b.html

		# These wraps define how the list of uploaded files for a single upload field looks like.
		singleFileMarkerTemplate {
			totalWrap = <div class="uploadedfiles controls"><span class="uploadedfiles-label">###LLL:uploadedFiles###</span><ul class="fileupload-list">|</ul></div>
			singleWrap = <li>|</li>
			showThumbnails = 0
		}

		files {

			# Path to upload the files to (must exist!)
			uploadFolder = {$plugin.formhandler.contact-form.storageFolder}

			# Allows the user to remove a previously uploaded file
			enableAjaxFileRemoval = 1
			enableFileRemoval = 1

			# The default value of the link to remove a file would be "X".
			customRemovalText = TEXT
			customRemovalText {
				value = <span class="fa fa-times-circle"></span>
			}
		}

		# This PreProcessor clear the files in the initial upload folder ("uploads/formhandler/") which are older than 24 hours.
		preProcessors {
			1.class = Tx_Formhandler_PreProcessor_ClearTempFiles
			1.config {
				clearTempFilesOlderThan {
					value = 24
					unit = hours
				}
			}

			2.class = PreProcessor_LoadDefaultValues
			2.config {
				1 {
					city {
						array.defaultValue = vibol@web-essentials.asia
					}
				}
			}
		}

		# This block defines the error checks performed when the user hits submit.
		validators {
			1.class = Validator_Default
			1.config.fieldConf {
				postCode.errorCheck.1 = required
				postCode.errorCheck.2 = integer
				town.errorCheck.1 = required
				i_would_like.errorCheck.1 = required
				street.errorCheck.1 = required
				file.errorCheck {
					# Allow only the configured file extensions
					1 = fileAllowedTypes
					1.allowedTypes = pdf, doc, docx, zip, jpg, png, jpeg

					# Max size of a file 2MB
					2 = fileMaxSize
					2.maxSize = 2097152

					# Max 3 files are allowed to be uploaded though this upload field
					3 = fileMaxCount
					3.maxCount = 1
				}
			}
		}

		# Finishers are called after the form was submitted successfully (without errors).
		finishers {

			# Finisher_Mail sends emails to an admin and/or the user.
			1.class = Finisher_Mail
			1.config {
				checkBinaryCrLf = message
				admin {
					templateFile = TEXT
					templateFile.value = {$plugin.formhandler.rootPath}email-admin-b.html
					attachment = file
				}
			}

			# Finisher_Redirect will redirect the user to another page after the form was submitted successfully.
			5.class = Finisher_Redirect
			5.config {
				redirectPage = {$plugin.formhandler.contact-form.redirectPage}
			}
		}
	}
}